﻿@{
    <link href="~/css/table.css" rel="stylesheet" />
    <script src="~/js/jquery-1.11.1.js"></script>
    <script src="~/js/vue.js"></script>
}

<style>
    .TD_STYLE2 select {
        width: 130px;
    }
</style>

<body>
    <div id="app">
        <form role="form" id="form1">
            <table width="100%">
                <tr>
                    <td>
                        <font color="#0000CC">您正在做的业务是:人力资源--调动管理--调动登记</font>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <input type="button" value="提交" class="BUTTON_STYLE1"
                               v-on:click="mySubmit()">
                        <input type="button" class="BUTTON_STYLE1"
                               onclick="javascript:window.history.back();" value="返回">
                    </td>
                </tr>
            </table>
            <table width="100%" border="1" cellpadding=0 cellspacing=1
                   bordercolorlight=#848284 bordercolordark=#eeeeee
                   class="TABLE_STYLE1">
                <tr height="21">
                    
                    <td class="TD_STYLE1" width="8%">
                        档案编号
                    </td>
                    <td class="TD_STYLE2" width="10%">
                        <input type="text" id="human_id" name="human_id" v-model="human_id" readonly="readonly"
                               class="INPUT_STYLE2">

                    </td>
                    <td class="TD_STYLE1" width="8%">
                        姓名
                    </td>
                    <td class="TD_STYLE2" width="10%">
                        <input type="text" id="human_name" name="human_name" v-model="human_name"
                               readonly="readonly"
                               class="INPUT_STYLE2">
                    </td>
                    <td class="TD_STYLE1" width="8%">
                    </td>
                    <td class="TD_STYLE2" width="10%">
                    </td>
                    <td class="TD_STYLE1" width="8%">
                    </td>
                    <td class="TD_STYLE2" width="10%">
                    </td>
                </tr>
                <tr>
                    <td class="TD_STYLE1" width="8%">
                        原一级机构
                    </td>
                    <td class="TD_STYLE2">
                        <input type="text" id="first_kind_name" name="first_kind_name"
                               v-model="first_kind_name" readonly="readonly"
                               class="INPUT_STYLE2">
                        <input type="hidden" id="first_kind_id" name="first_kind_id" v-model="first_kind_id">
                    </td>
                    <td class="TD_STYLE1" width="8%">
                        原二级机构
                    </td>
                    <td class="TD_STYLE2" width="10%">
                        <input type="text" id="second_kind_name" name="second_kind_name"
                               v-model="second_kind_name" readonly="readonly"
                               class="INPUT_STYLE2">
                        <input type="hidden" id="second_kind_id" name="second_kind_id" v-model="second_kind_id">
                    </td>
                    <td class="TD_STYLE1" width="8%">
                        原三级机构
                    </td>
                    <td class="TD_STYLE2" width="10%">
                        <input type="text" id="third_kind_name" name="third_kind_name"
                               v-model="third_kind_name" readonly="readonly"
                               class="INPUT_STYLE2">
                        <input type="hidden" name="third_kind_id" id="third_kind_id" v-model="third_kind_id">
                    </td>
                    <td class="TD_STYLE1" width="8%">
                    </td>
                    <td class="TD_STYLE2" width="10%">
                    </td>
                </tr>
                <tr>
                    <td class="TD_STYLE1">
                        原职位分类
                    </td>
                    <td class="TD_STYLE2">
                        <input type="text" id="major_kind_name" name="major_kind_name"
                               v-model="human_major_kind_name" readonly="readonly"
                               value="" class="INPUT_STYLE2">
                        <input type="hidden" id="major_kind_id" name="major_kind_id" v-model="human_major_kind_id">
                    </td>
                    <td class="TD_STYLE1" width="12%">
                        原职位名称
                    </td>
                    <td class="TD_STYLE2">
                        <input type="text" id="major_name" name="major_name"
                               v-model="hunma_major_name" readonly="readonly"
                               class="INPUT_STYLE2">
                        <input type="hidden" id="major_id" name="major_id" v-model="human_major_id">
                    </td>
                    <td class="TD_STYLE1">
                        原薪酬标准
                    </td>
                    <td class="TD_STYLE2">
                        <input type="text" id="salary_standard_name" name="salary_standard_name"
                               v-model="salary_standard_name"
                               readonly="readonly" class="INPUT_STYLE2">
                        <input type="hidden" id="salary_standard_id" name="salary_standard_id" v-model="salary_standard_id">
                    </td>
                    <td class="TD_STYLE1">
                        原薪酬总额
                    </td>
                    <td class="TD_STYLE2">
                        <input type="text" id="salary_sum" name="salary_sum" v-model="salary_sum"
                               readonly="readonly"
                               class="INPUT_STYLE2">
                    </td>
                </tr>
                <tr>
                    <td class="TD_STYLE1" width="160px">
                        新一级机构名称
                    </td>
                    <td class="TD_STYLE2">
                        <select name="new_first_kind_id" id="new_first_kind_id" v-model="new_first_kind_id" v-on:click="GetoneId()" class="INPUT_STYLE1">
                            <option value="0">请选择第I级机构名称</option>
                            <option v-for="(item,index) in onelist" :value="item.first_kind_id">{{item.first_kind_name}}</option>
                        </select>
                        <input hidden="hidden" id="new_first_kind_name" name="new_first_kind_name" v-model="new_first_kind_name" />
                    </td>
                    <td class="TD_STYLE1" width="160px">
                        新二级机构名称
                    </td>
                    <td class="TD_STYLE2">
                        <select name="new_second_kind_id" id="new_second_kind_id" v-model="new_second_kind_id" v-on:click="GettwoId()" class="INPUT_STYLE1">
                            <option value="0">请选择第II级结构名称</option>
                            <option v-for="(item,index) in secondlist" :value="item.second_kind_id">{{item.second_kind_name}}</option>
                        </select>
                        <input hidden="hidden" id="new_second_kind_name" name="new_second_kind_name" v-model="new_second_kind_name" />
                    </td>
                    <td class="TD_STYLE1" width="160px">
                        新三级机构名称
                    </td>
                    <td class="TD_STYLE2">
                        <select name="new_third_kind_id" id="new_third_kind_id" v-model="new_third_kind_id" v-on:click="GetthreeId()" class="INPUT_STYLE1">
                            <option value="0">请选择第III级结构名称</option>
                            <option v-for="(item,index) in thirdlist" :value="item.third_kind_id">{{item.third_kind_name}}</option>
                        </select>
                        <input hidden="hidden" id="new_third_kind_name" name="new_third_kind_name" v-model="new_third_kind_name" />
                    </td>
                    <td class="TD_STYLE1" width="8%">
                    </td>
                    <td class="TD_STYLE2" width="10%">
                    </td>
                </tr>
                <tr>
                    <td class="TD_STYLE1" width="160px">
                        新职位分类
                    </td>
                    <td class="TD_STYLE2">
                        <select name="new_major_kind_id" id="new_major_kind_id" v-model="new_major_kind_id" v-on:click="GetZwfl()" class="INPUT_STYLE1">
                            <option value="0">请选择新职位分类名称</option>
                            <option v-for="(item,index) in zwfllist" :value="item.major_kind_id">{{item.major_kind_name}}</option>
                        </select>
                        <input hidden="hidden" id="new_major_kind_name" name="new_major_kind_name" v-model="new_major_kind_name" />
                    </td>
                    <td class="TD_STYLE1" width="160px">
                        新职位名称
                    </td>
                    <td class="TD_STYLE2">
                        <select name="new_major_id" id="new_major_id" v-model="new_major_id" v-on:click="GetZwmc()" class="INPUT_STYLE1">
                            <option value="0">请选择新职位分类名称</option>
                            <option v-for="(item,index) in zwmclist" :value="item.major_id">{{item.major_name}}</option>
                        </select>
                        <input hidden="hidden" id="new_major_name" name="new_major_name" v-model="new_major_name" />
                    </td>
                    <td class="TD_STYLE1" width="160px">
                        新薪酬标准
                    </td>
                    <td class="TD_STYLE2">
                        <select name="new_salary_standard_id" id="new_salary_standard_id" v-model="new_salary_standard_id" v-on:blur="GetNxc()" class="INPUT_STYLE1">
                            <option value="0">请选择新职位分类名称</option>
                            <option v-for="(item,index) in xcbzlist" :value="item.standard_id">{{item.standard_name}}</option>

                        </select>
                        <input hidden="hidden" id="new_salary_standard_name" name="new_salary_standard_name" v-model="new_salary_standard_name" />
                    </td>
                    <td class="TD_STYLE1">
                        新薪酬总额
                    </td>
                    <td class="TD_STYLE2">
                        <input type="text" name="new_salary_sum" id="new_salary_sum" v-model="new_salary_sum" readonly="readonly"
                               value="0.00" class="INPUT_STYLE2">
                    </td>
                </tr>
                <tr>
                    <td class="TD_STYLE1">
                        登记人
                    </td>
                    <td class="TD_STYLE2">
                        <input type="text" name="register" id="register" readonly="readonly" value="better_admin"
                               class="INPUT_STYLE2">
                    </td>
                    <td class="TD_STYLE1">
                        登记时间
                    </td>
                    <td class="TD_STYLE2">
                        <input type="text" name="regist_time" readonly="readonly"
                               id="Tdate" class="INPUT_STYLE2">
                    </td>
                    <td class="TD_STYLE1">
                    </td>
                    <td class="TD_STYLE2">
                    </td>
                    <td class="TD_STYLE1">
                    </td>
                    <td class="TD_STYLE2">
                    </td>
                </tr>
                <tr>
                    <td class="TD_STYLE1">
                        调动原因
                    </td>
                    <td colspan="7" class="TD_STYLE2">
                        <textarea id="change_reason" name="change_reason" v-model="change_reason" rows="6" class="TEXTAREA_STYLE1"></textarea>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</body>

<script type="text/javascript">
    function time() {
        var tdate = document.getElementById("Tdate");
        var d = new Date();
        var y = d.getFullYear();
        var moth = d.getMonth() + 1;
        var date = d.getDate();
        var h = d.getHours();
        var m = d.getMinutes();
        var s = d.getSeconds();
        var hh = 20 - 1 - h;
        var mm = 60 - 1 - m;
        var ss = 60 - s;
        if (hh > 0) {
            mm = mm + 60 * hh;
        }
        if (moth < 10) {
            moth = "0" + moth;
        }
        if (date < 10) {
            date = "0" + date;
        }
        if (h < 10) {
            h = "0" + h;
        }
        if (m < 10) {
            m = "0" + m;
        }
        if (s < 10) {
            s = "0" + s;
        }
        if (mm < 10) {
            mm = "0" + mm;
        }
        if (ss < 10) {
            ss = "0" + ss;
        }
        tdate.value = y + "-" + moth + "-" + date + " " + h + ":" + m + ":" + s;
    }
    window.onload = time;
    var out = window.setInterval(time, 1000);

    var vm = new Vue({
        el: "#app",
        data: {
    onelist: [],//一级
    secondlist: [],//二级
    thirdlist: [],//三级
    zwfllist: [],  //职位分类
       zwmclist: [],//职位名称
      xcbzlist: [],//薪酬标准
	//mch_id : "",
    first_kind_id : "",
    first_kind_name : ""  ,
    second_kind_id : " " ,
   	second_kind_name : ""   ,
    third_kind_id : ""   ,
   	third_kind_name : ""    ,
   	human_major_kind_id : ""      ,
    human_major_kind_name : ""   ,
   	human_major_id : ""      ,
    hunma_major_name : ""    ,
   	new_first_kind_id : ""      ,
    new_first_kind_name : ""    ,
    new_second_kind_id : ""    ,
   	new_second_kind_name : ""      ,
    new_third_kind_id : ""      ,
    new_third_kind_name : ""    ,
    new_major_kind_id : ""     ,
     new_major_kind_name : ""     ,
   	new_major_id : ""        ,
    new_major_name : ""    ,
    human_id : ""    ,
    human_name : ""            ,
   	salary_standard_id : ""    ,
	salary_standard_name : ""  ,
  	salary_sum : ""          ,
    new_salary_standard_id : ""    ,
    new_salary_standard_name : ""  ,
  	new_salary_sum : ""  ,
  	change_reason : ""  ,
        },
        methods: {
            load: function () {
                var t = this;
              //  alert(@ViewData["id"]);
                $.ajax({
                    url: "/diaodongguanli/register1?id="+@ViewData["id"],
                    type: "post",
                      success: function (msg) {
                          var dt = eval("(" + msg + ")");
                   //     t.mch_id = dt.mch_id;
                        t.first_kind_id = dt.first_kind_id;
                        t.first_kind_name = dt.first_kind_name;
                        t.second_kind_id = dt.second_kind_id;
                        t.second_kind_name = dt.second_kind_name;
                        t.third_kind_id = dt.third_kind_id;
                          t.third_kind_name = dt.third_kind_name;
                          t.human_major_kind_id = dt.human_major_kind_id;
                          t.human_major_kind_name = dt.human_major_kind_name;
                          t.human_major_id = dt.human_major_id;
                          t.hunma_major_name = dt.hunma_major_name;
                        t.new_first_kind_id = dt.new_first_kind_id;
                        t.new_first_kind_name = dt.new_first_kind_name;
                        t.new_second_kind_id = dt.new_second_kind_id;
                        t.new_second_kind_name = dt.new_second_kind_name;
                        t.new_third_kind_id = dt.new_third_kind_id;
                        t.new_third_kind_name = dt.new_third_kind_name;
                        t.new_major_kind_id = dt.new_major_kind_id;
                        t.new_major_kind_name = dt.new_major_kind_name;
                        t.new_major_id = dt.new_major_id;
                        t.new_major_name = dt.new_major_name;
                        t.human_id = dt.human_id;
                        t.human_name = dt.human_name;
                        t.salary_standard_id = dt.salary_standard_id;
                        t.salary_standard_name = dt.salary_standard_name;
                        t.salary_sum = dt.salary_sum;
                        t.new_salary_standard_id = dt.new_salary_standard_id;
                        t.new_salary_standard_name = dt.new_salary_standard_name;
                         t.new_salary_sum = dt.new_salary_sum;
                        t.change_reason = dt.change_reason;
                    }
                });
            },
            mySubmit: function () {          
                //新1级
                var new_first_kind_name = $("#new_first_kind_id option:selected").text();
                $("#new_first_kind_name").val(new_first_kind_name);
                 //新2级
                var new_second_kind_name = $("#new_second_kind_id option:selected").text();
                $("#new_second_kind_name").val(new_second_kind_name);
                 //新3级
                var new_third_kind_name = $("#new_third_kind_id option:selected").text();
                $("#new_third_kind_name").val(new_third_kind_name);
                //新薪酬标准
                var new_salary_standard_name = $("#new_salary_standard_id option:selected").text();
                $("#new_salary_standard_name").val(new_salary_standard_name);
                //新职位分类名称
                var new_major_kind_name = $("#new_major_kind_id option:selected").text();
                $("#new_major_kind_name").val(new_major_kind_name);
                //新职位名称
                var new_major_name = $("#new_major_id option:selected").text();
                $("#new_major_name").val(new_major_name);
              

                $.ajax({
                    url: "/diaodongguanli/register",
                    type: "post",
                    data: $("#form1").serialize(),
                    success: function (msg) {
                        if (msg > 0) {
                            alert("登记成功！")
                            location.href = "/diaodongguanli/register_success";
                        }
                    }
                });
            },
            GetoneId: function () {
                var t = this;
                $.ajax({
                    url: "/diaodongguanli/one",
                    type: "Post",
                    success: function (msg) {
                        var dts = eval(msg);
                        t.onelist = dts;
                    }
                })
            },
            GettwoId: function () {
                var t = this;
                var new_first_kind_id = $("#new_first_kind_id").val();
                $.ajax({
                    url: "/diaodongguanli/two?t=" + new_first_kind_id,
                    type: "Post",
                    success: function (msg) {
                        var dts = eval("(" + msg + ")");
                        t.secondlist = dts;
                    }
                })
            }, GetthreeId: function () {
                var t = this;
                var new_second_kind_id = $("#new_second_kind_id").val();
                $.ajax({
                    url: "/diaodongguanli/three?t=" + new_second_kind_id,
                    type: "Post",
                    success: function (msg) {
                        var dts = eval("(" + msg + ")");
                        t.thirdlist = dts;
                    }
                })
            }, GetZwfl: function () {
                var t = this;
                $.ajax({
                    url: "/diaodongguanli/GetZwfl",
                    type: "Post",
                    success: function (msg) {
                        var dts = eval(msg);
                        t.zwfllist = dts;

                    }
                })
            }, GetZwmc: function () {
                var t = this;
                var new_major_kind_id = $("#new_major_kind_id").val();
                $.ajax({
                    url: "/diaodongguanli/GetZwmc?z=" + new_major_kind_id,
                    type: "Post",
                    success: function (msg) {
                        var dts = eval("(" + msg + ")");
                        t.zwmclist = dts;
                    }
                })
            }, GetXcbz: function () {
                var t = this;
                $.ajax({
                    url: "/diaodongguanli/GetXcsz",
                    type: "Post",
                    success: function (msg) {
                        var dts = eval(msg);
                        t.xcbzlist = dts;
                    }
                })
            }, GetNxc: function () {
                var new_salary_standard_id = $("#new_salary_standard_id").val();
              //  var t = this;
                //alert(new_salary_standard_id);
                $.ajax({
                    url: "/diaodongguanli/GetNxc?xc=" + new_salary_standard_id,
                    type: "Post",
                    success: function (msg) {
                        var dts = eval(msg);
                        $("#new_salary_sum").val(dts);
                    }
                })
            }
        },
        mounted: function () {
            this.load();
            this.GetXcbz();
        }
    })
</script>




